package models

import "time"

type Video struct {
	ID          uint      `json:"id" gorm:"primaryKey"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	CoverURL    string    `json:"cover_url"`
	VideoURL    string    `json:"video_url"`
	Duration    int       `json:"duration"` // 秒
	Category    string    `json:"category"`
	Tags        string    `json:"tags"`
	ViewCount   int64     `json:"view_count"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type VideoHistory struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	VideoID   uint      `json:"video_id"`
	Video     Video     `json:"video" gorm:"foreignKey:VideoID"`
	UserID    uint      `json:"user_id"`
	Progress  int       `json:"progress"` // 秒
	WatchTime time.Time `json:"watch_time"`
}

type VideoFavorite struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	VideoID   uint      `json:"video_id"`
	Video     Video     `json:"video" gorm:"foreignKey:VideoID"`
	UserID    uint      `json:"user_id"`
	CreatedAt time.Time `json:"created_at"`
}
